package com.ssy.lingxi.marketing.model.constant;

import java.util.Arrays;

/**
 * 超限规则枚举
 * @author yzc
 * @version 2.0.0
 * @date 2021/8/13
 */
public enum ExceedRuleEnum {

    /**
     * 原价购买/按个人限购最高级享受优惠 - 1
     */
    ORIGINAL_PREFERENTIAL(1, "原价购买/按个人限购最高级享受优惠"),

    /**
     * 不可购买 - 2
     */
    NO_BUY(2, "不可购买");


    private final Integer code;
    private final String message;

    ExceedRuleEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String getCodeMessage(Integer code) {
        ExceedRuleEnum status = Arrays.stream(ExceedRuleEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
        return status == null ? "未知" : status.getMessage();
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}